import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';

export interface IFormLabelProps {
  children?: React.ReactNode;
  align?: 'left' | 'center' | 'right';
}

export const FormLabel: React.SFC<IFormLabelProps> = ({ children, align }: IFormLabelProps) => {
  const textAlgin = align || 'left';

  return (
    <label className={classNames('br-form-label', `align-${textAlgin}`)}>
      <span className="br-form-label__content">{children}</span>
    </label>
  );
};

FormLabel.propTypes = {
  children: PropTypes.node,
  align: PropTypes.oneOf(['left', 'center', 'right']),
};
